package pers.aidenj.ostrich.controller.swagger;


import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiOperation;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import pers.aidenj.ostrich.service.DictionaryService;


@Controller
@RequestMapping("dataSource")
public class SwaggerDataSource {
	
	@Resource
	DictionaryService dictionaryService;

	@ApiOperation(value = "默认库查询", notes = "默认库查询", httpMethod = "GET")
	@RequestMapping(value="getAllDictionary", method= RequestMethod.GET)
	@ResponseBody
	public JSONObject getAllDictionary(){
		JSONObject jo = new JSONObject();
		jo.put("model", dictionaryService.getAllDictionary());
		return jo;
	}
	
    @ApiOperation(value = "主库无注解查询", notes = "主库无注解查询", httpMethod = "GET")
    @RequestMapping(value="getAllDictionaryMaster", method= RequestMethod.GET)
    @ResponseBody
    public JSONObject getAllDictionaryMaster(){
    	JSONObject jo = new JSONObject();
    	jo.put("model", dictionaryService.getAllDictionaryMaster());
        return jo;
    }
    
    @ApiOperation(value = "主库注解查询", notes = "主库注解查询", httpMethod = "GET")
    @RequestMapping(value="getAllDictionaryMasterDataSource", method= RequestMethod.GET)
    @ResponseBody
    public JSONObject getAllDictionaryMasterDataSource(){
    	JSONObject jo = new JSONObject();
    	jo.put("model", dictionaryService.getAllDictionaryMasterDataSource());
        return jo;
    }
    
    @ApiOperation(value = "从库无注解查询", notes = "从库无注解查询", httpMethod = "GET")
    @RequestMapping(value="getAllDictionarySlave", method= RequestMethod.GET)
    @ResponseBody
    public JSONObject getAllDictionarySlave(){
    	JSONObject jo = new JSONObject();
    	jo.put("model", dictionaryService.getAllDictionarySlave());
        return jo;
    }
    
    @ApiOperation(value = "从库注解查询", notes = "从库注解查询", httpMethod = "GET")
    @RequestMapping(value="getAllDictionarySlaveDataSource", method= RequestMethod.GET)
    @ResponseBody
    public JSONObject getAllDictionarySlaveDataSource(){
    	JSONObject jo = new JSONObject();
    	jo.put("model", dictionaryService.getAllDictionarySlaveDataSource());
        return jo;
    }
}
